<div class="rightBorder" id="rightinfo_content">
<div class="briefMenu modal-header border-bottom clearfix">
    <div class="modal-title text-truncate fs-6">
        <button type="button" class="mdi mdi-chevron-left mdi-right-backing dcolor" data-rid="$ridval" onclick="reback_last(this)"></button>
        <span class="right-imgname text-truncate">{lang dynamic}<span class="text-muted">（{$total}条记录）</span></span>
    </div>
    <button type="button" class="toggRight btn-close"></button>
</div>
<div class="dynconMenu p-2 scroll-y" id="dynconMenu" data-subtractor="{eval echo ($pfid || $rid)?53:0}">
<ul class="lyear-timeline lyear-timeline-left just-now" id="just-now"></ul>
<!--{if $events}-->
<ul class="lyear-timeline lyear-timeline-left">
<!--{loop $events $eventval}-->
<li class="lyear-timeline-item dynameic-comment">
    <div class="lyear-timeline-item-dot">
      <span><a href="user.php?uid=$eventval['uid']" title="$eventval['username']" target="_blank">{eval echo avatar_block($eventval['uid']);}</a></span>
    </div>
    <div class="lyear-timeline-item-content">
      <p class="mb-1 text-break" title="$eventval['username']"><strong>$eventval['username']</strong></p>
      <p class="mb-1 text-break">{$eventval[details]}</p>
      <p class="mb-0">
        <time class="mb-3">{eval echo dgmdate($eventval['dateline'], 'u');}</time>
        <!--{if $eventval['type'] == 1}--><span class="delete-comment color-danger mdi mdi-delete" data-commentid="$eventval[id]"></span><!--{/if}-->
       </p>
    </div>
</li>
<!--{/loop}--> 
</ul>
<!--{if $next}-->
<div class="mb-1 d-grid">
    <a href="javascript:;" class="btn_dynamic_more_less btn-link" onclick="load_dynamic(this,'$next','{eval if(!is_array($rids)) $rids = (array)$rids;echo implode(',',$rids);}','$pfid',1);">{lang upload_more}</a>
</div>
<!--{/if}-->
<!--{/if}-->
</div>
<!--右侧底部评论开始-->
<!--{if $pfid || $rid}-->
<div class="comment-area dtheme">
    <div class="messageMenu"> 
	    <form action="{MOD_URL}&op=ajax&operation=comment" method="post" onsubmit="return comment_file(this)" id="commentid">
	        <input type="hidden" name="rid" value="$rid" />
	        <input type="hidden" name="fid" value="$pfid" />
	    	<div class="discuss-content">
	            <textarea type="text" id="leave_message" name="msg" rows="1"  placeholder="{lang input_comments}" class="form-control"></textarea>
	            <div class="comment-file">
	                <ul class="list_acpsw">
	                    <li class="emotion_lacpsw"><a href="javascript:;" class="item_lacpsw" id="leave_messagesml" onclick="showMenu({'ctrlid':this.id,'evt':'click','layer':2});return false;"><span class="mdi mdi-emoticon-excited-outline"></span></a>
	                    </li>
	                </ul>
	            </div>
	        </div>
	        <div class="activity-handler clearfix">		            
	             <button type="submit" class="mdi mdi-send pull-right disabled input-search-drop" style="color:rgba(55,121,255,0.3);"></button>
	        </div>
	    </form>
    </div>
</div>
<!--{/if}-->
<!--右侧底部评论结束-->
</div>
<script type="text/javascript">
jcLoader().load({  
        type:'js', 
        ids:'js_textareaexplander', 
        url:'static/js/jquery.textareaexplander.js?{VERHASH}'  
    },function(){
        jQuery('#leave_message').TextAreaExpander(32,300);
});
jQuery(document).ready(function(e) {
    jQuery('.dynconMenu.scroll-y').scroll(function(e) {
        var clientHeight = jQuery('.dynconMenu.scroll-y').height();
        var scrollHeight =jQuery('.dynconMenu.scroll-y').get(0).scrollHeight;
        if(jQuery('.dynconMenu.scroll-y').scrollTop()+clientHeight>scrollHeight-20) 	jQuery('.btn_dynamic_more_less').trigger('click');
        if($(this).scrollTop()>0){
            $('.briefMenu').css({'box-shadow':'0px 0px 10px 0px rgba(0,0,0,0.15)'});
        }else{
            $('.briefMenu').css({'box-shadow':'none'});
        }
    })
});

jQuery(document).off('click.commentdelete').on('click.commentdelete','.delete-comment',function(){
	var obj = $(this);
    var commentid = obj.data('commentid');
    if(typeof commentid == 'undefined' || commentid < 0){
        layer.alert('{lang delete_error}', {skin:'lyear-skin-danger'});
    }
    layer.confirm(__lang.delete_filenorecover_confirm, {title:__lang.delete_comment_confirm,skin:'lyear-skin-danger'}, function(index){
		layer.msg(__lang.recovering_not_please_close, {offset:'10px',time:0});
		$.post('{MOD_URL}&op=dynamic&do=deletecomment',{'id':commentid},function(data){
        if(data['success']){
            obj.parents('.dynameic-comment').html('');
            layer.msg('删除成功', {offset:'10px'});
        }else if(data['error']){
            layer.alert(data['error'], {skin:'lyear-skin-danger'});
        }
    },'json').fail(function (jqXHR, textStatus, errorThrown) {
            showmessage('操作失败，请稍后再试: ' + textStatus, 'error', 3000, 1);
        });
	});
    
})
jQuery(function(){
    if (gid && jQuery('#commentid').length > 0) {
        commentfid = jQuery('#commentid').find('input[name=fid]').val();
        commentrid = jQuery('#commentid').find('input[name=rid]').val();
        var cachequeryMentions = [], itemsMentions;
        var querystr = '';
        if(commentfid){
            querystr = '&fid='+commentfid;
        }else{
            querystr = '&rid='+commentrid;
        }
        jQuery('#leave_message').atwho({
            at: "@",
            data: '{DZZSCRIPT}?mod=explorer&op=group&do=group_ajax&operation=getAtData&gid=' + gid+querystr,
            callbacks: {
                remote_filter: function (query, render_view) {
                    console.log(query);
                    var thisVal = query,
                        self = jQuery(this);
                    if (!self.data('active') && thisVal.length >= 1) {
                        self.data('active', true);
                        itemsMentions = cachequeryMentions[thisVal]
                        if (typeof itemsMentions == "object") {
                            render_view(itemsMentions);
                        } else {
                            if (self.xhr) {
                                self.xhr.abort();
                            }
                            self.xhr = jQuery.getJSON('{DZZSCRIPT}?mod=explorer&op=group&do=group_ajax&operation=getAtData&gid=' + gid+querystr,{
                                term: thisVal
                            }, function (data) {
                                cachequeryMentions[thisVal] = data
                                render_view(data);
                            });
                        }
                        self.data('active', false);
                    }
                }
            },
            tpl: "<li data-value='@[${name}:${id}]' title='${title}'>${avatar}&nbsp;${name}</li>",
            search_key: "searchkey",
            start_with_space: false,
            limit: 5,
            max_len: 20,
            display_timeout: 300
        });
    }

})
function reback_last(obj){
    var ridmatch = /\w{32}/;
    var rid = $(obj).data('rid');
    var url = '',questry={};
    if(ridmatch.test(rid)){
        url = MOD_URL+'&op=dynamic&do=getfiledynamic';
        questry.rid = rid;
    }else{
        url = MOD_URL+'&op=dynamic&do=getfolderdynamic';
        questry.fid = rid;
    }
    $.post(url,questry,function(data){
        $('#rightMenu').html(data);
    });
    _filemanage.infoPanelUrl=rid;
  return false;
}
</script>